import 'package:gameplay_flutter/generated/json/base/json_convert_content.dart';
import 'package:gameplay_flutter/m_discover/post/model/at_user_model.dart';

ATUserModel $ATUserModelFromJson(Map<String, dynamic> json) {
  final ATUserModel aTUserModel = ATUserModel();
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    aTUserModel.type = type;
  }
  final String? text = jsonConvert.convert<String>(json['text']);
  if (text != null) {
    aTUserModel.text = text;
  }
  final String? userId = jsonConvert.convert<String>(json['userId']);
  if (userId != null) {
    aTUserModel.userId = userId;
  }
  final String? imId = jsonConvert.convert<String>(json['imId']);
  if (imId != null) {
    aTUserModel.imId = imId;
  }
  final String? url = jsonConvert.convert<String>(json['url']);
  if (url != null) {
    aTUserModel.url = url;
  }
  final int? userStatus = jsonConvert.convert<int>(json['userStatus']);
  if (userStatus != null) {
    aTUserModel.userStatus = userStatus;
  }
  final String? nickname = jsonConvert.convert<String>(json['nickname']);
  if (nickname != null) {
    aTUserModel.nickname = nickname;
  }
  final String? userRemark = jsonConvert.convert<String>(json['userRemark']);
  if (userRemark != null) {
    aTUserModel.userRemark = userRemark;
  }
  return aTUserModel;
}

Map<String, dynamic> $ATUserModelToJson(ATUserModel entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['type'] = entity.type;
  data['text'] = entity.text;
  data['userId'] = entity.userId;
  data['imId'] = entity.imId;
  data['url'] = entity.url;
  data['userStatus'] = entity.userStatus;
  data['nickname'] = entity.nickname;
  data['userRemark'] = entity.userRemark;
  return data;
}

extension ATUserModelExtension on ATUserModel {
  ATUserModel copyWith({
    int? type,
    String? text,
    String? userId,
    String? imId,
    String? url,
    int? userStatus,
    String? nickname,
    String? userRemark,
  }) {
    return ATUserModel()
      ..type = type ?? this.type
      ..text = text ?? this.text
      ..userId = userId ?? this.userId
      ..imId = imId ?? this.imId
      ..url = url ?? this.url
      ..userStatus = userStatus ?? this.userStatus
      ..nickname = nickname ?? this.nickname
      ..userRemark = userRemark ?? this.userRemark;
  }
}
